





int romanToInt(char* s) {
    int ret = 0;
    enum date
    {
        I=1,
        V = 5,
        X = 10,
        L = 50,
        C = 100,
        D = 500,
        M = 1000
    };
    while (*s)
    {
        switch (*s)
        {
        case 'I':
            if (*(s + 1) && *(s + 1) != 'I')
                ret -= I;
            else
                ret += I;
            break;
        case 'X':
            if (*(s + 1) && *(s + 1) == 'L' || *(s + 1) == 'C')
                ret -= X;
            else
                ret += X;
            break;
        case 'C':
            if (*(s + 1) && *(s + 1) == 'D' || *(s + 1) == 'M')
                ret -= C;
            else
                ret += C;
            break;
        case 'V':
            ret += V;
            break;
        case 'L':
            ret += L;
            break;
            case 'D':
                ret += D;
                break;
            case 'M':
                ret += M;
                break;
        }
        s++;

    }
}